package com.example.basic.kts


fun main(args: Array<String>) {

    var rfcRecurrenceRuleString = "FREQ=MONTHLY;WKST=SU;BYMONTHDAY=2,3,4,5,6,7,8,9"

    val partIndex = rfcRecurrenceRuleString.indexOf("BYMONTHDAY")
    if (partIndex == -1) {
        println("partIndex = $partIndex")
    }

    val list = rfcRecurrenceRuleString.substring(partIndex).split(";")

    for(str in list) {
        println(str)
    }

    val firstOrNull = list.firstOrNull()?.split("=")?.lastOrNull()?.split(",")?.map {
        it.toInt()
    }
    println("firstOrNull = $firstOrNull")


    var arr = listOf(1, 3, 5, 7, 9)
    val joinToString = arr.joinToString(",", "","")

    println(joinToString)





//        .firstOrNull()?.split("=")?.lastOrNull()?.split(",")?.map {
//            it.toInt()
//        }
}